package c_Arrays;

import java.util.Arrays;

/**
 * @author Cheng-02
 * @version V1.0
 * @Package c_Arrays
 * @date 2024/4/6 16:33
 */
public class test01 {
    public static void main(String[] args) {
        int[] arr = {1, 23, 4, 4, 5};
        System.out.println(Arrays.toString(arr));//[1, 23, 4, 4, 5]
        Arrays.sort(arr);
        System.out.println(Arrays.toString(arr));//[1, 4, 4, 4, 23]
        int[] arr1 = {1, 3, 4, 645, 123, 523, 5, 346, 346, 4, 324, 3, 534, 5, 4};
        Arrays.sort(arr1);
        System.out.println(Arrays.binarySearch(arr1, 4));//使用二分法查找，返回索引
        int[] arr2 = {1, 3, 4, 645, 123, 523, 5, 346, 346, 4, 324, 3, 534, 5, 4};
        int[] arr3 = Arrays.copyOf(arr2, 30);//扩充数组到30个
        System.out.println(Arrays.toString(arr3));

    }
}
